<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>活动时间收集</title>
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
        }
        
        body {
            background: linear-gradient(135deg, #6e45e2 0%, #88d3ce 100%);
            min-height: 100vh;
            display: flex;
            justify-content: center;
            align-items: center;
            padding: 20px;
            position: relative;
            overflow: hidden;
        }
        
        /* 二次元元素装饰 */
        .anime-element {
            position: absolute;
            z-index: -1;
            opacity: 0.6;
        }
        
        .anime-1 {
            top: 10%;
            left: 5%;
            width: 150px;
            height: 150px;
            background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><circle cx="50" cy="50" r="40" fill="%23ff9a9e" /></svg>') no-repeat;
        }
        
        .anime-2 {
            bottom: 15%;
            right: 8%;
            width: 120px;
            height: 120px;
            background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><polygon points="50,15 85,85 15,85" fill="%23a18cd1" /></svg>') no-repeat;
        }
        
        .anime-3 {
            top: 20%;
            right: 15%;
            width: 100px;
            height: 100px;
            background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><rect x="15" y="15" width="70" height="70" fill="%23fbc2eb" /></svg>') no-repeat;
        }
        
        .container {
            background: rgba(255, 255, 255, 0.9);
            backdrop-filter: blur(10px);
            border-radius: 20px;
            box-shadow: 0 15px 30px rgba(0, 0, 0, 0.2);
            width: 90%;
            max-width: 500px;
            padding: 30px;
            text-align: center;
        }
        
        h1 {
            color: #6e45e2;
            margin-bottom: 20px;
            font-size: 28px;
        }
        
        p {
            color: #555;
            margin-bottom: 25px;
            line-height: 1.6;
        }
        
        .time-selector {
            display: flex;
            justify-content: center;
            gap: 15px;
            margin: 25px 0;
        }
        
        .time-input {
            display: flex;
            flex-direction: column;
            align-items: center;
        }
        
        .time-input label {
            margin-bottom: 8px;
            color: #666;
            font-weight: 500;
        }
        
        .time-input select {
            padding: 12px;
            border: 2px solid #ddd;
            border-radius: 10px;
            font-size: 18px;
            width: 100px;
            text-align: center;
            background: white;
            cursor: pointer;
            transition: border-color 0.3s;
        }
        
        .time-input select:focus {
            border-color: #6e45e2;
            outline: none;
        }
        
        button {
            background: #6e45e2;
            color: white;
            border: none;
            padding: 14px 28px;
            border-radius: 10px;
            font-size: 18px;
            cursor: pointer;
            transition: background 0.3s, transform 0.2s;
            margin: 10px 0;
        }
        
        button:hover {
            background: #5836bb;
            transform: translateY(-2px);
        }
        
        button:active {
            transform: translateY(0);
        }
        
        .submissions {
            margin-top: 30px;
            text-align: left;
            max-height: 200px;
            overflow-y: auto;
        }
        
        .submissions h2 {
            color: #6e45e2;
            font-size: 20px;
            margin-bottom: 15px;
            text-align: center;
        }
        
        #timeList {
            list-style-type: none;
        }
        
        #timeList li {
            background: #f0f0f0;
            margin: 8px 0;
            padding: 12px;
            border-radius: 8px;
            display: flex;
            justify-content: space-between;
        }
        
        .empty-message {
            text-align: center;
            color: #888;
            font-style: italic;
            margin: 15px 0;
        }
        
        @media (max-width: 500px) {
            .time-selector {
                flex-direction: column;
                align-items: center;
            }
            
            .container {
                padding: 20px;
            }
        }
    </style>
</head>
<body>
    <!-- 装饰性二次元元素 -->
    <div class="anime-element anime-1"></div>
    <div class="anime-element anime-2"></div>
    <div class="anime-element anime-3"></div>

    <div class="container">
        <h1>⏰ 活动时间收集</h1>
        <p>请选择您期望的活动开始时间，您的选择将帮助我们确定最佳的活动安排。</p>
        
        <div class="time-selector">
            <div class="time-input">
                <label for="hour">时</label>
                <select id="hour">
                    <option value="">--</option>
                    <!-- 小时选项由JS生成 -->
                </select>
            </div>
            
            <div class="time-input">
                <label for="minute">分</label>
                <select id="minute">
                    <option value="">--</option>
                    <!-- 分钟选项由JS生成 -->
                </select>
            </div>
        </div>
        
        <button id="submitBtn">提交时间</button>
        
        <div class="submissions">
            <h2>已提交的时间</h2>
            <div id="timeListContainer">
                <p class="empty-message">暂无提交的时间</p>
                <ul id="timeList"></ul>
            </div>
        </div>
    </div>

    <script>
        document.addEventListener('DOMContentLoaded', function() {
            // 生成小时选项
            const hourSelect = document.getElementById('hour');
            for (let i = 0; i < 24; i++) {
                const option = document.createElement('option');
                option.value = i < 10 ? '0' + i : i;
                option.textContent = i < 10 ? '0' + i : i;
                hourSelect.appendChild(option);
            }
            
            // 生成分钟选项
            const minuteSelect = document.getElementById('minute');
            for (let i = 0; i < 60; i += 5) {
                const option = document.createElement('option');
                option.value = i < 10 ? '0' + i : i;
                option.textContent = i < 10 ? '0' + i : i;
                minuteSelect.appendChild(option);
            }
            
            // 加载已保存的时间
            loadSavedTimes();
            
            // 提交按钮事件
            document.getElementById('submitBtn').addEventListener('click', function() {
                const hour = hourSelect.value;
                const minute = minuteSelect.value;
                
                if (!hour || !minute) {
                    alert('请选择完整的时间');
                    return;
                }
                
                const timeString = `${hour}:${minute}`;
                saveTime(timeString);
                addTimeToList(timeString);
                
                // 清空选择
                hourSelect.value = '';
                minuteSelect.value = '';
            });
        });
        
        // 保存时间到localStorage
        function saveTime(time) {
            let times = JSON.parse(localStorage.getItem('activityTimes') || '[]');
            times.push({
                time: time,
                timestamp: new Date().toLocaleString()
            });
            localStorage.setItem('activityTimes', JSON.stringify(times));
        }
        
        // 从localStorage加载已保存的时间
        function loadSavedTimes() {
            const times = JSON.parse(localStorage.getItem('activityTimes') || '[]');
            const timeList = document.getElementById('timeList');
            const emptyMessage = document.querySelector('.empty-message');
            
            if (times.length > 0) {
                emptyMessage.style.display = 'none';
                times.forEach(item => {
                    addTimeToList(item.time, item.timestamp);
                });
            }
        }
        
        // 添加时间到列表
        function addTimeToList(time, timestamp = null) {
            const timeList = document.getElementById('timeList');
            const emptyMessage = document.querySelector('.empty-message');
            
            if (emptyMessage.style.display !== 'none') {
                emptyMessage.style.display = 'none';
            }
            
            const li = document.createElement('li');
            if (!timestamp) {
                timestamp = new Date().toLocaleString();
            }
            li.innerHTML = `<span>${time}</span><span>${timestamp}</span>`;
            timeList.appendChild(li);
        }
    </script>
</body>
</html>